<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>首页</title>

    <link rel="stylesheet" th:replace="base::styles"/>
</head>
<body>
<div th:replace="base::nav-bar"></div>

<div class="row">
    <div class="col-lg-2"></div>
    <div class="col-lg-8">
        <a class="btn btn-primary" href="/person/add">添加</a>
        <table class="table  table-striped table-bordered">
            <tr>
                <th>头像</th>
                <th>编号</th>
                <th>姓名</th>
                <th>年龄</th>
                <th>住址</th>
                <th>时间</th>
                <th>操作</th>
            </tr>
            <tr th:each="person:${person}">
                <td>
                    <a th:href="@{/person/avatar/{id}(id=${person.id})}">
                        <img th:src="${person.avatar}" style="width: 50px;height: 50px;" alt="头像"/>
                    </a>
                </td>
                <td th:text="${person.id}"></td>
                <td th:text="${person.name}"></td>
                <td th:text="${person.age}"></td>
                <td th:text="${person.address.name}"></td>
                <td th:text="${#dates.format(person.registerDate,'yyyy-MM-dd')}"></td>
                <td>
                    <a class="btn btn-info" th:href="@{/person/{id}(id=${person.id})}">修改</a>
                    <form th:action="@{/person/{id}(id=${person.id})}" method="post" style="display: inline;">
                        <input type="hidden" name="_method" value="delete"/>
                        <button class="btn btn-danger" type="submit">删除</button>
                    </form>

                </td>
            </tr>
        </table>
    </div>
    <div class="col-lg-2"></div>
</div>


<div th:replace="base::scripts"></div>
</body>
</html>